<template>
  <div>
    <div class="home-swipe">
      <mt-swipe :auto="5000">
        <mt-swipe-item v-for="(item,index) in bannerList" :key="index">
          <img :src="item.picture" class="imga" />
        </mt-swipe-item>
      </mt-swipe>
    </div>
  </div>
</template>

<script>
import api from "../../api/api.js";
export default {
  data() {
    return {
      bannerList: [],
      prePushTime: "" //取年月日
    };
  },
  created() {
    this.datevalue = this.formatDate(new Date().getTime()); //时间年月日时分秒
    this.prePushTime = this.datevalue.substring(0, 11); //取年月日
    this.getBanner();
  },
  methods: {
    //轮播图
    getBanner() {
      this.$http({
        method: "post",
        url: api.baseURL + "queryAdvertisingList",
        params: {
          inParam: {
            time: this.datevalue,
            sysCode: "FH_PUBOPE",
            // sysCode: "FH_ZSK", //测试
            // accId: 1,
            accId: 2, //测试
            advertisingPosition: 1,
            key: 8
          }
        }
      })
        .then(response => {
          console.log("轮播图");
          console.log(response.data.data);
          this.bannerList = response.data.data;
          // this.bannerList = [
          //   {
          //     url: "../../../static/lunbo.png"
          //   },
          //   {
          //     url: "../../../static/lunbo.png"
          //   }
          // ];
          console.log(this.bannerList);
        })
        .catch(error => {
          console.log(error);
        });
    }
  }
};
</script>

<style scoped>
.home-swipe {
  height: 22vh;
  width: 100%;
  overflow: hidden;
}
.imga{
  width: 100%;
  height: 22vh;
}
</style>